package Terminal.View;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import Terminal.View.Gestori.GestoreInterfaccia;

public class JBottoniTimeRecordCRUD extends JBottoniTimeRecord{
	JButton nuovoTimerecord;
	JButton modificaTimerecord;
	JButton deleteTimerecord;
	
	public JBottoniTimeRecordCRUD(){
		super();
	}

	@Override
	public void createComponents() {
		this.setBounds(20, 601, 1280, 80);
		this.setLayout(null);
		setBottoni();
	//	this.setBackground(Color.WHITE);
		add(nuovoTimerecord);
		add(modificaTimerecord);
		add(deleteTimerecord);
		setVisible(true);
	}
	
	private void setBottoni(){
		nuovoTimerecord = new JButton("Nuovo TimeRecord");
		nuovoTimerecord.setBounds(200,15,150,50);//100, 30,nuovoTimerecord.getPreferredSize().width,30);
		nuovoTimerecord.addActionListener(new ActionListener() {
					
			@Override
			public void actionPerformed(ActionEvent arg0) {
				mediator.smista("GestireTimeRecord", "VisualizzaNuovoTimeRecord");				
			}
		});
		
		modificaTimerecord = new JButton("Modifica TimeRecord");
		modificaTimerecord.setBounds(925, 15,modificaTimerecord.getPreferredSize().width,50);
		modificaTimerecord.addActionListener(new ActionListener() {
					
			@Override
			public void actionPerformed(ActionEvent arg0) {
				mediator.smista("GestireTimeRecord", "VisualizzaModificaTimeRecord");				
			}
		});
		
		deleteTimerecord = new JButton("Cancella TimeRecord");
		deleteTimerecord.setBounds(1125, 15,deleteTimerecord.getPreferredSize().width,50);
		deleteTimerecord.addActionListener(new ActionListener() {
					
			@Override
			public void actionPerformed(ActionEvent arg0) {
				mediator.smista("GestireTimeRecord", "VisualizzaDeleteTimeRecord");				
			}
		});
		
	}

	public void setDisabilitaNuovo() {
		nuovoTimerecord.setEnabled(false);
		
	}
	

}
